<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/commons/jsp/taglibs.jsp"%>
<%@taglib uri="http://www.framework.com/taglib" prefix="frame"%>
  <head>
	<title>公共平台 </title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  </head>
  
  <body>
    <div class="easyui-layout" data-options="fit:true,border:false" >
			<div data-options="region:'center',border:false" style="padding: 4px;">
		    <table id="listProjectsBidTable" class="easyui-datagrid" 
				data-options="singleSelect:false,toolbar:'#goodstb',method:'post',rownumbers:true,fit:true,fitColumns:true,border:true,
					pagination:true,multiSort:true,remoteSort:true,striped:true,onLoadSuccess:function(data){$('#'+projectsParamObj.searchID).attr('disabled',false);},
					url:'${ctx}/business/projectmanage/expert/expertBidList?projectId=${projectId}'">
				<thead>
					<tr>
						<th data-options="field:'bidderName',width:80,title:'投标单位',sortable:true" align="center"></th>
						<th data-options="field:'bidAmount',width:50,title:'报价金额(${project.bidType==0 ?'元':'%'})',sortable:true" align="center"></th>
						<th data-options="field:'bidTime',width:80,title:'投标时间',sortable:true,formatter: function(value,row,index){return value+'.'+row.millisecond}" align="center"></th>
						<th data-options="field:'discountAmount',width:100,title:'小微企业扣除(${project.bidType==0 ?'元':'%'})',sortable:true" align="center"></th>
						<th data-options="field:'evalutionResult',width:60,formatter: function(value,row,index){if(value==1){return '通过';}else if(value==2){return '无效标';}else if(value==3){return '无需评审';}else{{return '未评';}}},title:'状态',sortable:true" align="center"></th>
						<th data-options="field:'operation',width:150,title:'操作',formatter:getOptionsBtn" align="center" ></th>
				</tr>
				</thead>
			</table>
			
				
		</div>
	</div>
	<div id="bindPicDialog"></div>
	<div id="selPicDialog"></div>
	<div id="noCompetReasonDialog"></div>
</body>
	<script type="text/javascript">
		//初始化表格对应的js对象
		var projectsParamObj;
		$(function() {
			//初始化表格对象数据
			projectsParamObj = new initParams(
					{
						paramObjName : 'projectsParamObj',//表格对应的实体对象名称，好区分多个表格情况下的对象
						tableId:'listProjectsTable',
						addDataFormId:'addProjectsDataForm',
						showDialogId:'firstLevelDialog',
						searchID:'searchProjects',
						resetSearchID:'resetsearchProjects',
						searchFormID:'searchProjectsForm',
						updateUrl:"${ctx}/business/projectmanage/input?projectId=",
						deleteUrl:'${ctx}/business/projectmanage/remove',
						addDialogWidth:700,
						addDialogHeight:520,
						ctx:'${ctx}',
						addDialogTitle:'采购项目信息'
					});
			//初始化查询
			init(projectsParamObj);
			//setTimeout(function(){
				//$.parser.parse(".optionsAreas");
			//},1000);
		});
		
		/**
		 * 操作按钮处理
		 * @param {Object} value
		 * @param {Object} row
		 * @param {Object} index
		 */
		function getOptionsBtn(value, row, index){
			var btnsHtml = "<span class='optionBtnsArea'>";
			var evaluatePassHtml = '<a href="javascript:void(0)" onclick="evaluatePass(\'' + row.id + '\')" class="">无效标</a>&nbsp;';
			var infoViewHtml = '<a href="javascript:void(0)" onclick="getProjectDetail(\'' + row.id + '\')" class="">详情</a>&nbsp;';
			var inquiryLetterHtml = '<a href="${ctx}/business/projectmanage/public/letterPrint?projectId='+ row.projectId +'&bidderId='+row.userId+'" class=""  target="_blank">询标函</a>&nbsp;';
			if(row.evalutionResult!=2){//显示无效标
				btnsHtml+=evaluatePassHtml;
			}
			btnsHtml+=inquiryLetterHtml; 
			btnsHtml+=infoViewHtml; 
			
			return btnsHtml +"</span>";
		}

		
		/**
		 * 打开评标窗体
		 */
		 function evaluatePass(id){
			 $.messager.confirm('提示',"您确定要无效标操作吗？",function(result){
				 if(result){
					 $.ajax({
							type: "POST",
							timeout:20000,
							url:  "${ctx}/business/projectmanage/expert/doSubmitInvalidBid?id="+id,
							success: function(data){
								if(data =="success"){
									top.$.messager.alert("提示",'提交成功','info',function(){
										$('#listProjectsBidTable').datagrid('reload');
										//top.$('#firstLevelDialog').dialog('close');
										//top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
									});
								} else {
									top.$.messager.alert('提示',"提交失败！",'info');
								}
							},
							error: function(res){
								
							}
						});
				 }
			 });
		 }
		
		
		
		/**
		*投标详情
		*/
		function getProjectDetail(id){
			top.$('#secondtLevelDialog').dialog({    
			    title:"投标详情",  
			    iconCls:'icon-view',
			    width: 1000,    
			    height: 580,    
			    closed: false,    
			    inline : true,
			    cache: false,    
			    href: "${ctx}/business/projectmanage/getBidDetail?id=" + id,
			    modal: true,
				extractor : function(data){
					if($.trim(data) == "unLogin"){
						var msn = ''||i18n[''];
						msn = msn||i18n[data];
						if(msn != undefined){
							top.$.messager.alert('提示',msn,'info',function(){top.location='ctx/manage';});
							return '';
						}
					}
					return data;
				},
			    buttons : [{
						text:projectsParamObj.cancelButton,
						iconCls:'icon-cancel',
						handler:function(){
							top.$('#secondtLevelDialog').dialog('close');
						}}]
			});
			top.$('#'+projectsParamObj.showDialogId).dialog("center");
		}




		
						
</script>